import('fs').then((fs) => {
  const jsonStr = fs.readFileSync('package.json').toString('utf-8');
  const json = JSON.parse(jsonStr);
  json.version = upgradeVersion(json.version);
  fs.writeFileSync('package.json', JSON.stringify(json, '', 2));
});

function upgradeVersion(v) {
  const vs = v.split('.');
  vs[vs.length - 1]++;
  return vs.join('.');
}
